<template>
  <div>
    <template v-for="menu in menuList">
      <el-menu-item :index="menu.router" :key="menu.no" v-if="menu.type == 0">
        <el-icon>
          <component :is="menu.icon" />
        </el-icon>
        <span>{{ menu.name }}</span>
      </el-menu-item>
    </template>
    <template v-for="menu in menuList">
      <el-sub-menu :index="menu.router" :key="menu.no" v-if="menu.type == 1">
        <template v-slot:title>
          <el-icon>
            <component :is="menu.icon" />
          </el-icon>
          <span>{{ menu.name }}</span>
        </template>
        <menu-tree :menu-list="menu.children"></menu-tree>
      </el-sub-menu>
    </template>
  </div>
</template>

<script setup lang="ts">

defineProps({
  menuList: {
    type: Array<any>,
    required: true
  }
})
</script>

<style scoped>

</style>
